]> dgit.raspbian.org Git - grub2.git/commit
[PATCH 2/3] term/serial: Reject caller-supplied port addresses under lockdown
authorAndrew Hamilton <adhamilt@gmail.com>
Tue, 15 Sep 2026 22:49:10 +0000 (17:49 -0500)
committerSteve McIntyre <93sam@debian.org>
Wed, 23 Sep 2026 20:39:45 +0000 (21:39 +0100)
commit0cb6c85508ec54ed994ffe3df7aff9415c149695
tree83831cf03f8c69cd61e32686f6e38172728f1d0a
parentde13c5935f41ab1ecf6c587b292f58a6c815787f
[PATCH 2/3] term/serial: Reject caller-supplied port addresses under lockdown

The serial command is available in lockdown mode and the port option
accepts a raw port address or a raw mmio base address. This can be
misused to allow an attacker to write to local memory and do things
including disabling / bypassing secure boot as long as the
console is available or an unsigned GRUB configuration is under
the attacker's control.

Update the serial logic to only accept a raw address in lockdown when
a port is already registered at it, which means the platform described
that UART: grub_ns8250_init() for the legacy com<N> ports,
grub_pciserial_init() for an enumerated PCI device, or an ACPI SPCR
UART once "auto" has parsed the table. Names that are not addresses
are untouched, so "auto", efi<N> from grub_efiserial_init() - the
route on arm64, which has neither ns8250 nor SPCR support - and
lookups by registered name all keep working.

Behavior without lockdown (no secure boot) is unchanged.

Assisted-by: Claude:Opus-5
(Tweaked to fit into the 2.14 codebase by Steve McIntyre <93sam@debian.org>

Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Leo Sandoval <lsandova@redhat.com>
Part-of: <https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/266>

Gbp-Pq: Topic upstream
Gbp-Pq: Name 0002-term-serial-Reject-caller-supplied-port-addresses-un.patch
grub-core/term/ns8250-spcr.c
grub-core/term/ns8250.c
grub-core/term/serial.c
include/grub/serial.h